import { createVNode, render } from 'vue'

import Message from './Message.vue'

const divVnode = createVNode('div', { class: 'xtx-message-container' })
render(divVnode, document.body)

const div = divVnode.el

const YKMessage = ({ message, type }) => {
  const comVNode = createVNode(Message, { message, type })
  render(comVNode, div)
  setTimeout(() => {
    render(null, div)
  }, 3000)
}

export default YKMessage
